]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
panel: Only update appMenu icon when the app actually changed
authorJonas Dreßler <verdre@v0yd.nl>
Mon, 1 Mar 2021 09:07:27 +0000 (10:07 +0100)
committerMarge Bot <marge-bot@gnome.org>
Tue, 9 Mar 2021 13:15:09 +0000 (13:15 +0000)
Right now we always recreate the icon of the appMenu when calling
_sync(). This will relayout the panel everytime we open the overview,
because we call _sync() in that case.

We can easily avoid that by only recreating the icon actor in case the
app that's opened actually changes. This gets us close to doing no more
relayouts of the panel when opening the overview.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1733>

js/ui/panel.js

index 8ca5d038d07219ae4e167a4c9823f8b57e983f1e..cba32416a21d15619bd79b7ed2a53ef1eb9514e3 100644 (file)
@@ -244,11 +244,8 @@ var AppMenuButton = GObject.registerClass({
         });
     }
 
-    _syncIcon() {
-        if (!this._targetApp)
-            return;
-
-        let icon = this._targetApp.create_icon_texture(PANEL_ICON_SIZE - APP_MENU_ICON_MARGIN);
+    _syncIcon(app) {
+        const icon = app.create_icon_texture(PANEL_ICON_SIZE - APP_MENU_ICON_MARGIN);
         this._iconBox.set_child(icon);
     }
 
@@ -256,7 +253,8 @@ var AppMenuButton = GObject.registerClass({
         if (this._iconBox.child == null)
             return;
 
-        this._syncIcon();
+        if (this._targetApp)
+            this._syncIcon(this._targetApp);
     }
 
     stopAnimation() {
@@ -324,6 +322,8 @@ var AppMenuButton = GObject.registerClass({
                 this._busyNotifyId = this._targetApp.connect('notify::busy', this._sync.bind(this));
                 this._label.set_text(this._targetApp.get_name());
                 this.set_accessible_name(this._targetApp.get_name());
+
+                this._syncIcon(this._targetApp);
             }
         }
 
@@ -343,7 +343,6 @@ var AppMenuButton = GObject.registerClass({
 
         this.reactive = visible && !isBusy;
 
-        this._syncIcon();
         this.menu.setApp(this._targetApp);
         this.emit('changed');
     }